<template>
  <div>
    测试8
    <el-button type="text" @click="anniu">点击打开 Dialog</el-button>
    <el-button @click="xinzeng">新增</el-button>

    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="30%"
    >
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="yuqian">取 消</el-button>
        <el-button v-if="delag === 'b'?true:false" type="primary" @click="zhanchunjie">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dialogVisible: false,
      delag: ''
    }
  },
  methods: {
    anniu() {
      this.delag = 'a'
      this.dialogVisible = !this.dialogVisible
    },
    xinzeng() {
      this.delag = 'b'
      this.dialogVisible = !this.dialogVisible
    },
    yuqian() {
      this.dialogVisible = !this.dialogVisible
    },
    zhanchunjie() {
      if (this.delag === 'a') {
        alert('是从 按钮 打开弹窗')
      } else if (this.delag === 'b') {
        alert('是从 新增 打开弹窗')
      }
      this.dialogVisible = !this.dialogVisible
    }
  }
}
</script>

<style>

</style>
